<?php

require_once 'Zend/View/Helper/Abstract.php';

class Core_View_Helper_Admin_SelectUser extends Zend_View_Helper_Abstract
{
    public function selectUser($name, $value = null, $attribs = null, $currentUser = 0)
    {
        $u = new Model_User();
        $users = $u->fetchAll(null, 'first_name');

        $options[] = $this->view->getTranslation('Select User');

        if ($users->count() > 0) {
            foreach ($users as $user) {
                if ($user->name != $currentUser) {
                   $options[$user->name] = $user->first_name . ' ' . $user->last_name;
                }
            }
        }

        $form   = new Core_Form();
        $select = $form->createElement('select', $name, array(
            'multiOptions'  => $options,
        ));
        if (is_array($value)) {
            $select->setValue($value);
        }
        if (is_array($attribs)) {
            $select->setAttribs($attribs);
        }
        return $select;
    }
}